package com.guoamo.mapdemo;

import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;

public class MapDemoB {


    public static void main(String[] args) {

        LinkedHashSet<String> set = new LinkedHashSet<>();
//        set.add("");


//        LinkedHashMap<String, Integer> map = new LinkedHashMap<>();


        Map<String, Integer> dictionary = new LinkedHashMap<>();

        dictionary.put("apple", 1);
        dictionary.put("banana", 2);
        dictionary.put("cherry", 3);
        dictionary.put("date", 4);


        Set<Map.Entry<String, Integer>> entries = dictionary.entrySet();

        for (Map.Entry<String, Integer> entry : entries) {
//            System.out.println(entry.getKey() + " " + entry.getValue());
        }


        Map<String, Integer> history = new LinkedHashMap<>(16, 0.75f, true);

        history.put("google.com", 1);
        history.put("github.com", 2);
        history.put("stackoverflow.com", 3);


        System.out.println(history);
        history.get("google.com");

        System.out.println(history);

        // 用户访问新网站
        history.put("oracle.com", 4);
        System.out.println(history);
    }

}
